<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="./jquery-3.6.0.min.js"></script>
    <script type="text/javascript">
        $(function() {
            $("#myButton").click(function() {
                alert($("input[name='myCheck']:checked").length);
            });
        });
    </script>
</head>

<body>
    <input type="checkbox" name="myCheck" />
    <input type="checkbox" name="myCheck" checked="checked" />
    <input type="checkbox" name="myCheck" />
    <input type="checkbox" name="myCheck" />
    <input type="checkbox" name="myCheck" />
    <input type="checkbox" name="myCheck" />

    <input type="button" id="myButton" value="统计" />
</body>

</html>